<template>
<div class="company-help">
  <classList></classList>
      <section class="introduction">
          <div class="title">
        <p>课程列表</p>
      </div>
    <el-table
      v-loading="listLoading"
      :data="list"
      element-loading-text="数据加载中"
      border
      fit
      highlight-current-row
      style="width: 98%">
      <el-table-column
        label="序号"
        width="70"
        align="center">
        <template slot-scope="scope">
          {{ (page - 1) * limit + scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column prop="name" label="姓名" width="150" />
      <el-table-column prop="classs" label="班级" width="150" />
      <el-table-column prop="major" label="专业" width="150" />
      <el-table-column prop="academy" label="学院" width="150" />
      <el-table-column prop="intro" label="简介" />
<!--      <el-table-column label="操作" width="200" align="center">-->
<!--        <template slot-scope="scope">-->
<!--          <router-link :to="">-->
<!--            <el-button type="primary" size="mini" icon="el-icon-edit">查看</el-button>-->
<!--          </router-link>-->
<!--        </template>-->
<!--      </el-table-column>--> 
    </el-table>
    <el-pagination
      :current-page="page"
      :page-size="limit"
      :total="total"
      style="padding: 30px 0; text-align: center;"
      layout="total, prev, pager, next, jumper"
      @current-change="fetchData"
    />
 </section>
</div>
</template>

<script>
 import student from "api/student";
import classList from 'views/comp/classList'

export default {
name: "studentTable",
components:{
 classList
},
  data(){
    return {
      listLoading: true, // 是否显示loading信息
      list: null, // 数据列表
      total: 0, // 总记录数
      page: 1, // 页码
      limit: 10, // 每页记录数
      searchObj: {},// 查询条件
      classId:'',
    }
  },
  created() {
  
    if(this.$store.state.userinfo.classId=='')
    {
   this.classId=this.$store.state.userinfo.classId
    }
 
  
  this.fetchData()

  },
       computed: {
      isFollow () {
        return this.$store.state.userinfo.classId;　　//需要监听的数据
      }
    },
    watch: {
      isFollow (newVal, oldVal) {
        this.classId=newVal
        this.fetchData(1)
      }
    },
  methods:{
    fetchData(page = 1) { // 调用api层获取数据库中的数据
      this.page = page
      this.listLoading = true
      this.searchObj.classs=this.id
      this.searchObj.classs=this.classId
      student.getPageList(this.page, this.limit, this.searchObj).then(response => {

        // debugger 设置断点调试

          this.list = response.data.data.rows

          this.total = response.data.data.total

        this.listLoading = false
      }).catch(error=>{

      })
    },
  }


}
</script>


<style lang="stylus" scoped>
  .company-help {
    background: #e4e5e6;
    .user-info {
      font-size: 14px;
      background: #fafafa;
      margin-bottom: 20px;
      .title {
        background: #f0f1f3;
        height: 36px;
        line-height: 36px;
        p {
          display inline-block;
          height: 16px;
          line-height 16px;
          margin: 0 6px 0px 12px;
          padding-left: 6px;
          border-left: solid 4px #057ab8;
          vertical-align middle;
        }
      }
      .info {
        padding: 10px 0 10px 30px;
        .logo {
          display inline-block;
          width: 60px;
          height: 60px;
          margin-top: 8px;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .info-right {
          display: inline-block;
          padding-top: 8px;
          min-height: 76px;
          line-height: 22px;
          margin-left: 12px;
          vertical-align: top;
          .account {
            font-weight: bold;
          }
        }
      }
    }
    .introduction {
      font-size: 14px;
      background: #fafafa;
      margin-bottom: 38px;
      .title {
        background: #f0f1f3;
        height: 36px;
        line-height: 36px;
        p {
          display inline-block;
          height: 16px;
          line-height 16px;
          margin: 0 6px 0px 12px;
          padding-left: 6px;
          border-left: solid 4px #057ab8;
          vertical-align middle;
        }
      }
      .intro {
        padding: 10px 0 10px 30px;
        li {
          padding: 10px;
          .icon-search {
            display:inline-block;
            width: 52px;
            height: 52px;
             background-image: url('/views/comp/features.png');
            background-position: 0 0;
          }
          .intro-detail {
            display: inline-block;
            margin-left: 12px;
            line-height: 20px;
            font-size: 12px;
            vertical-align: top;
            .intro-title {
              color: #0079bd;
              cursor: pointer;
            }
          }
        }
      }
    }
  }
</style>


